//
//  ShoppingCartViewController.m
//  大轮胎
//
//  Created by 刘恪纲 on 2017/3/23.
//  Copyright © 2017年 zyc. All rights reserved.
//

#import "ShoppingCartViewController.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "LoadData.h"
#import "Model.h"
#import "YCNetWork.h"
#import <YYModel.h>

@interface ShoppingCartViewController ()
{
    NSArray * arr;
    Model_Two * t;
}
@property (weak, nonatomic) IBOutlet UIImageView *backgroundImage;
@property (weak, nonatomic) IBOutlet UILabel *titleText;
@property (weak, nonatomic) IBOutlet UILabel *peopleText;
@property (weak, nonatomic) IBOutlet UILabel *priceText;
@property (weak, nonatomic) IBOutlet UILabel *xinPrice;
@property (weak, nonatomic) IBOutlet UIWebView *web;
@property (weak, nonatomic) IBOutlet UILabel *company;
@property (weak, nonatomic) IBOutlet UILabel *telephone;


@end

@implementation ShoppingCartViewController
-(void)viewWillAppear:(BOOL)animated
{
     self.tabBarController.tabBar.hidden = YES;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    
  
    [self tabbar];
    [self getMessageTwo:self.ids];

    
    
}
-(void)getMessageTwo:(NSString *)ids
{
    [YCNetWork getWithURLString:[NSString stringWithFormat:@"http://lscy4.caeac.com.cn/api/product.php?appkey=1138&id=%@&token=",ids] parameters:self success:^(NSDictionary *data) {
        
        
        t = [Model_Two yy_modelWithJSON:data];
        NSLog(@"1111%@",t.photo_string);
        NSLog(@"%@",[[t.photo_string lastObject]objectForKey:@"img_big"]);
        
        [self data];
        

    } failure:^(NSError *error) {
        
        
    }];
}
-(void)tabbar
{
    self.title = @"详情";
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
}
-(void)data
{

  
    [self.backgroundImage sd_setImageWithURL:[NSURL URLWithString:  [[t.photo_string lastObject]objectForKey:@"img_big"]]] ;
    
    
    NSLog(@"-----123%@",self.price);
    
    //商品名称
    self.titleText.text = self.name;
    self.titleText.font = [UIFont boldSystemFontOfSize:20];
    self.titleText.numberOfLines = 0;
    //最新价格
    self.xinPrice.text = [NSString stringWithFormat:@"¥ %@",self.newprice];
    self.xinPrice.font = [UIFont boldSystemFontOfSize:19];
    //原价
    self.priceText.text = [NSString stringWithFormat:@"¥ %@",self.price];
    self.priceText.font = [UIFont systemFontOfSize:15];
    //已购买人数
    self.peopleText.text = [NSString stringWithFormat:@"%@人已买",self.renqi];
    //产品参数
    [_web loadHTMLString:t.concent baseURL:nil];
     //公司
    self.company.text = t.partner;
    
    //电话
    self.telephone.text = t.partner_tel;
        

  
    
    
   }
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)shareBtn:(id)sender {
    NSLog(@"您点击了分享");
}
- (IBAction)shopBtn:(id)sender {
    NSLog(@"您点击了店铺");
}
- (IBAction)payBtn:(id)sender {
    NSLog(@"您点击了关注");
}
- (IBAction)shoppCarBtn:(id)sender {
    NSLog(@"您点击了购物车");
}
@end
